package views;
import java.awt.Component;
import java.awt.FlowLayout;

import javax.swing.Box;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import presenters.PersonalInfoPresenter;


public class PersonalInfoPanel extends JPanel {
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
	private PersonalInfoPresenter myPresenter;

	/**
	 * Create the panel.
	 */
	public PersonalInfoPanel() {
		setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		Box verticalBox = Box.createVerticalBox();
		add(verticalBox);
		
		JLabel lblNewLabel = new JLabel("First Name:");
		verticalBox.add(lblNewLabel);
		
		textField_4 = new JTextField();
		verticalBox.add(textField_4);
		textField_4.setColumns(10);
		
		Component verticalStrut_1 = Box.createVerticalStrut(20);
		verticalBox.add(verticalStrut_1);
		
		JLabel lblNewLabel_1 = new JLabel("Middle Initial:");
		verticalBox.add(lblNewLabel_1);
		
		textField = new JTextField();
		verticalBox.add(textField);
		textField.setColumns(10);
		
		Component verticalStrut_2 = Box.createVerticalStrut(20);
		verticalBox.add(verticalStrut_2);
		
		JLabel lblLastName = new JLabel("Last Name:");
		verticalBox.add(lblLastName);
		
		textField_1 = new JTextField();
		verticalBox.add(textField_1);
		textField_1.setColumns(10);
		
		Component verticalStrut_3 = Box.createVerticalStrut(20);
		verticalBox.add(verticalStrut_3);
		
		JLabel lblEmailAddress = new JLabel("Email Address:");
		verticalBox.add(lblEmailAddress);
		
		textField_2 = new JTextField();
		verticalBox.add(textField_2);
		textField_2.setColumns(10);
		
		Component verticalStrut_4 = Box.createVerticalStrut(20);
		verticalBox.add(verticalStrut_4);
		
		JLabel lblPhoneNumber = new JLabel("Phone Number:");
		verticalBox.add(lblPhoneNumber);
		
		textField_3 = new JTextField();
		verticalBox.add(textField_3);
		textField_3.setColumns(10);
		
		Component verticalStrut_5 = Box.createVerticalStrut(20);
		verticalBox.add(verticalStrut_5);
		
		JLabel lblAddress = new JLabel("Address:");
		verticalBox.add(lblAddress);
		
		textField_5 = new JTextField();
		verticalBox.add(textField_5);
		textField_5.setColumns(10);

		myPresenter = new PersonalInfoPresenter(this);
	}
	
	public void process(String planName, String card_no) {
		String fName = textField_4.getText();
		String lName = textField_1.getText();
		String mInitial = textField.getText();
		String email = textField_2.getText();
		String phone = textField_3.getText();
		String address = textField_5.getText();
		
		myPresenter.addInfo(fName, mInitial, lName, email, phone, address, planName, card_no);
	}

	
	public PersonalInfoPresenter getMyPresenter() {
		return myPresenter;
	}
	
	public void setFields(String fName, String mInit, String lName, String email, String phone, String address) {
		textField_4.setText(fName);
		textField.setText(mInit);
		textField_1.setText(lName);
		textField_2.setText(email);
		textField_3.setText(phone);
		textField_5.setText(address);
	}
}
